home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 07 - 1991 / 07.12 Dec 91 / MacSocket Code / MacSocket.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-04-18  |  2.6 KB  |  101 lines  |  [TEXT/KAHL]

  1. /***
  2.  *** Copyright (c) 1990 Rijksinstituut voor Visserijonderzoek.
  3.  *** All rights reserved.
  4.  ***
  5.  *** Redistribution and use in source and binary forms are permitted
  6.  *** provided that this notice is preserved and that due credit is given
  7.  *** to the Rijksinstituut voor Visserijonderzoek at IJmuiden.
  8.  *** This software is provided "as is" without express or implied warranty.
  9.  ***
  10.  *** @(#)MacSocket.h 1.2 91/01/25
  11.  ***/
  12.  
  13. #ifndef _MacSocket_H_
  14. #define _MacSocket_H_
  15.  
  16. #include    <stdio.h>
  17. #include    <stdlib.h>
  18. #include    <string.h>
  19. #include    <unix.h>
  20. #include    <DeviceMgr.h>
  21.  
  22. #include    "types.h"
  23. #include    "socket.h"
  24. #include    "in.h"
  25. #include    "netdb.h"
  26. #include    "TCPPB.h"
  27.  
  28. #ifdef    LAB_VIEW
  29.  
  30. /* to prevent the use of the malloc() call in a LabVIEW CIN */
  31. #define    SockElmnt    theSockElmnt
  32. #define    SizeOf(x)    x
  33. #define    malloc(x)    &x
  34.  
  35. #else
  36.  
  37. #define    SizeOf    sizeof
  38.  
  39. #endif    LAB_VIEW
  40.  
  41. #ifndef NIL
  42. #define    NIL                ((void*) 0L)
  43. #endif    NIL
  44. #ifndef    InFrontOfAll
  45. #define    InFrontOfAll    ((Ptr) -1L)
  46. #endif    InFrontOfAll
  47. #ifndef True
  48. #define True            (1)
  49. #endif    True
  50. #ifndef False
  51. #define False            (0)
  52. #endif    False
  53. #define    Abort            True
  54. #define    ReportIt        False
  55. #define    Asynchronous    True
  56. #define    Synchronous        False
  57. #define    ConnectTimeout    (15)
  58. #define    SendTimeout        (15)
  59. #define    RecvTimeout        (15)
  60. #define    CloseTimeout    (15)
  61. #define    SockBufSize        (16384)
  62. #define    UserDataSize    (128)
  63.  
  64. #define    noTCPDriver        (-1)
  65. #define invalidArgument    (2)
  66. #define    nonSOCK_STREAM    (13)
  67. #define    nonSocket        (38)
  68. #define    nonAF_INET        (43)
  69. #define    noBufSpace        (55)
  70. #define    commandInProgress    (1)
  71.  
  72. /* to force the application first to use the MacSocket versions */
  73. #define    perror    perror_MacSocket
  74. #define    exit    exit_MacSocket
  75. #define    close    close_MacSocket
  76. #define    strerror    strerror_MacSocket
  77.  
  78. /* Prototypes */
  79. int        accept(int s, struct sockaddr *addr, int addrlen);
  80. int        bind(int s, struct sockaddr *name, int namelen);
  81. int        close_MacSocket(int s);
  82. int        connect(int s, struct sockaddr_in *name, int namelen);
  83. void    exit_MacSocket(int status);
  84. int        listen(int s, int backlog);
  85. void    perror_MacSocket(char *s);
  86. int        recv(int s, char *msg, int len, int flags);
  87. int        recvfrom(int s, char *msg, int len, int flags, struct sockaddr_in *from,
  88.             int *fromlen);
  89. int        recvmsg(int s, struct msghdr *msg, int flags);
  90. int        send(int s, char *msg, int len, int flags);
  91. int        sendto(int s, char *msg, int len, int flags, struct sockaddr_in *to, int tolen);
  92. int        sendmsg(int s, struct msghdr *msg, int flags);
  93. int        shutdown(int s, int how);
  94. #ifdef    MAC_APPL
  95. void    SetDialogShowTime(int sec);
  96. #endif    MAC_APPL
  97. int        socket(int domain, int type, int protocol);
  98. char*    strerror_MacSocket(int errnum);
  99.  
  100. #endif _MacSocket_H_
  101.